import { successResponse, errorResponse } from "server/utils/response";
import { Projects } from "server/models/Project";

export default defineEventHandler(async (event) => {
  try {
    // 获取项目统计信息
    const stats = await Projects.getProjectStats();

    return successResponse(stats, "获取项目统计成功");
  } catch (error) {
    console.error("获取项目统计失败:", error);
    return errorResponse(
      "获取项目统计失败",
      error instanceof Error ? error.message : "未知错误"
    );
  }
});
